﻿<?php
require_once("../public_files/conn.php");
require_once("../public_files/fenye.php");
	$type=$_POST['type'];		//官方or用户
	$listname_id=$_POST['listname_id'];		///获得分类ID
	$pagenum=$_POST['pagenum'];
	
if($type==0){
	$table3="official_list_mode";
	$table4="official_list_content";
	}else{
	$table3="user_list_mode";
	$table4="user_list_content";
	
	}


															
//////分页/////////////////////////////////////////////////////////////////////////////////////////////
					$page=isset($_POST['page'])?intval($_POST['page']):1;
				$num=10;	//每页显示条信息
				$count_mode=mysql_num_rows(mysql_query("select * from ".$table3." where name_id='$listname_id'")); //多少个mode
				$total=mysql_num_rows(mysql_query("select * from ".$table4." where list_name_id='$listname_id'"));		//多少条数据
				$total=($total/$count_mode);					//多少条
							
				$pagenum=ceil($total/$num);										//总共有多少页
				If($page>$pagenum || $page == 0){
						echo "error : Can Not Found The page .";
						exit;
				}
				
				$offset=($page-1)*$num*$count_mode;//从第几页开始从数据库取数据
				$numb=$num*$count_mode;				//取多少条		
				$mode=mysql_query("select * from ".$table3."  where name_id='$listname_id'");
				$result=mysql_query("select * from ".$table4."  where list_name_id='$listname_id'  limit $offset,$numb")or die(mysql_error());
						
///////////////////////////////////输出列表/////////////////////////////////////////						
				if(($total%$num !=0) && $page==$pagenum){
					$count = $total%$num;
					}else{ 
					$count=$num; } 	
		for($k=0;$k<$count;$k++){			//条
					
					
					?>
			<div class="content_1" onmouseover="show_more(<?php echo $k+1;?>)" onmouseout="hide_more(<?php echo $k+1;?>)">	
				<div class="rank_singer" >
					
							<span class="rank_num"><?php echo ($k+1); ?></span>			<!----榜单排名-->
							<div class="pic_1">
								<img src="../image/<?php $rows=mysql_fetch_array($result);echo  $rows['content']; ?>"/>
							</div>

					<div class="info_content">
					<?php	
					
							if($count_mode==4){
							?>
							<div class="songer">
								<span><?php $rows=mysql_fetch_array($result); echo $rows['content'];?></span>
							</div>
							
							
							
							<?php }
							else if($count_mode==5){?>
							<div class="songer">
								<span><?php $rows=mysql_fetch_array($result); echo $rows['content'];?></span>
							</div>
							<div class="song_title">
							
								<div class="song">
									<span><?php $rows=mysql_fetch_array($result); echo $rows['content'];?></span>
								</div>
							</div>
							
							
							
							
							<?php }else if($count_mode==6){?>
							<div class="songer">
								<span><?php $rows=mysql_fetch_array($result); echo $rows['content'];?></span>
							</div>
							<div class="song_title">
								<div class="song">
									<span><?php $rows=mysql_fetch_array($result); echo $rows['content'];?></span>
								</div>							
								<div class="list_more_btn" id="more_button<?php echo $k+1;?>">
									<?php $rows=mysql_fetch_array($result); $more=$rows['content'];?>
									<span OnClick="show_detail(<?php echo $k+1;?>);">More...</span>
								</div>
							</div>
							
							<?php
							}
					?>
					</div>
				</div>
									<!--顶、踩按钮-->
							<div class="support_hate">	
								<div class="support">
								<?php $rows=mysql_fetch_array($result); ?>
									<input type="button" class="support_after" name="Ding" id="d<?php echo $rows['id']+100; ?>" value="" onclick="vote(0,<?php echo $rows['id']; ?>,<?php echo $listname_id; ?>,<?php echo $rows['ranking']; ?>,<?php echo $type; ?>)"/>
									<span id="v<?php echo $rows['id']+100; ?>" class="p1"><?php echo $rows['content']; ?></span>
								</div>
								<div class="hate">
									<?php $rows=mysql_fetch_array($result); ?>
									<input type="button" name="Cai" value="" class="hate_after" id="c<?php echo $rows['id']+100; ?>" onclick="vote(1,<?php echo $rows['id']; ?>,<?php echo $listname_id; ?>,<?php echo $rows['ranking']; ?>,<?php echo $type; ?>)"/>
									<span id="s<?php echo $rows['id']+100; ?>" class="hate_num"><?php echo $rows['content']; ?></span>
								</div>
							</div>
							<div style="clear:both;"></div>
							<?php 
								if($count_mode==6){
							?>
							<div class="list_more_btn3" id="More<?php echo $k+1; ?>">
								<div class="detail">
									<p><?php  echo $more;?></p>
								</div>
								<div class="detail_close_btn">
									<span OnClick="close_detail(<?php echo $k+1; ?>);">Close</span>
								</div>
							</div>
							
								
			<?php
								}
				?>
				</div>	
		
		<?php	} 
			echo '<div class="feiye">';
			 fenyexianshi($page,$pagenum,$type,"content_fenye",$listname_id," -5","-5 ");////////////////逻辑分页、分块
			echo '</div>'; 	
	
	


?>